package my.kwantlen.assignment2;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class SplashScreen extends Activity {
	
	protected int splashTime = 5000; //length of splash screen
	
	private Thread splashTread;//creates new thread
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.splash);
	    final SplashScreen sPlashScreen = this;
	    splashTread = new Thread() {//begins new thread
	        @Override
	        public void run() {
	            try {	            	
	            	synchronized(this){
	            		wait(splashTime);
	            	}
	            	
	            } catch(InterruptedException e) {} 
	            finally {
	                finish();//splash finishes
	                Intent i = new Intent();
	                i.setClass(sPlashScreen, Main.class);//calls the main class
	        		startActivity(i);// starts main
	                stop();
	            }
	        }
	    };
	    
	    splashTread.start();
	}		
}